<?
/**
 * Main.php
 *
 * This is an example of the main page of a website. Here
 * users will be able to login. However, like on most sites
 * the login form doesn't just have to be on the main page,
 * but re-appear on subsequent pages, depending on whether
 * the user has logged in or not.
 *
 */
include("include/session.php");
?>


<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="Description" content="Information about the Symposium on Racing & Gaming, presented by the University of Arizona Race Track Industry Program. Includes sponsors, exhibitors, panel sessions, award winners, photos, transcripts and presentations" />
    <meta name="Keywords" content="horseracing, horse racing, race track education, race horse, racehorse, greyhound tracks, horsetrack, thoroughbred racing, quarterhorse racing, horse breeding, pari-mutuel, parimutuel, equine education, greyhound racing, dog racing, harness racing, horse training, symposium on racing, multi-breed, racetrack industry, turf racing, rtip, gaming, betting, racetrack betting, University of Louisville, racetrack education, racetrack school, race track school, horseracing school, horseracing college, horse racing college, racetrack college, race track college, equine school, equine college, equine program, symposium on gaming" />
 
   <title>Symposium Login</title>
    <link href="css/rtip.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>

<div id="wrap">
    <div id="topbar">
	<a href="http://www.arizona.edu/" target="_blank"></a>
    </div>
    <div id="top">
        <div id="head_image"> </div>
    </div>

    <div id="page_head">
        <h2 id="left_head"> </h2>
        <h2 id="right_head"> </h2>

    </div>

<table>
<tr><td>


<?
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){
   $userPoints = $database->getUserPoints($session->username);
   $req_user_info = $database->getUserInfo($session->username);
   echo "<h1> Welcome <b>".$req_user_info['fname']." ".$req_user_info['lname']."</b> </h1>"
       ."<h2>you have: </br> $userPoints QRedits</h2>";
       ?> <FORM METHOD="LINK" ACTION="useredit.php">
      <INPUT TYPE="submit" VALUE="Edit Account">
      </FORM>
      <FORM METHOD="LINK" ACTION="contacts.php">
      <INPUT TYPE="submit" VALUE="My Contacts">
      </FORM><?
   if($session->isAdmin()){?>
      <FORM METHOD="LINK" ACTION="register.php">
      <INPUT TYPE="submit" VALUE="Register">
      </FORM>
      <FORM METHOD="LINK" ACTION="admin/admin.php">
      <INPUT TYPE="submit" VALUE="Admin Center">
      </FORM><?
   }
      ?> <FORM METHOD="LINK" ACTION="process.php">
      <INPUT TYPE="submit" VALUE="Logout">
      </FORM><?   
}
else{
?>
<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
</table>
</form>

<?
}


?>
</td></tr>
</table>
</div>
</body>
</html>
